feat/batches: upload large exec artifacts#1324
Draft
burmudar wants to merge 1 commit into
Draft
Conversation
Batch executor jobs can produce stdout, stderr, and diffs large enough to bloat the final JSONL result stream. Upload oversized step artifacts from the existing `src batch exec` execution path instead of adding a separate command or user-facing auth flags. `src batch exec` now discovers the executor job context from the environment, uses the existing executor job bearer token plus executor name auth model to stream large artifacts to the Batch Changes artifacts endpoint, and records returned references on `AfterStepResult`. Small outputs stay inline for compatibility, and per-step progress output is suppressed when artifact uploads are enabled so large logs are not duplicated into task-step JSONL events. companian branch in sg: wb/proto-exec-upload Test Plan: - go test ./cmd/src ./internal/batches/executor ./internal/batches/ui github.com/sourcegraph/sourcegraph/lib/batches/execution
cae7f52 to
f1430c1
Compare
Member
keegancsmith
left a comment
There was a problem hiding this comment.
You should avoid wrapping the Body in your own reader which computes size. Check the docstring for NewRequestWithContext it already has special handling for a bunch of types you are using (mostly around setting ContentLength and retries).
If you wanna be fancy maybe something like
interface UploadBody {
ContentLength() (int64, error)
GetBody() (io.Reader, error)
}
would work nicely (check NewRequestWithContext implementation). Then just remember to wrap io.Reader in NopCloser and to seek to the start of the file on each call to GetBody (or just re-open the file?)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Batch executor jobs can produce stdout, stderr, and diffs large enough to bloat the final JSONL result stream. Upload oversized step artifacts from the existing
src batch execexecution path instead of adding a separate command or user-facing auth flags.src batch execnow discovers the executor job context from the environment, uses the existing executor job bearer token plus executor name auth model to stream large artifacts to the Batch Changes artifacts endpoint, and records returned references onAfterStepResult. Small outputs stay inline for compatibility, and per-step progress output is suppressed when artifact uploads are enabled so large logs are not duplicated into task-step JSONL events.Related in
sg/sg:Test Plan:
Test plan